package vip.xiaonuo.smzq.modular.jsxm.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.jsxm.entity.PsbaYqclBscl;
import vip.xiaonuo.smzq.modular.jsxm.service.IPsbaYqclBsclService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 建设项目—附件
 *
 * @author sqq
 * @since 2024-05-24
 */
@Api(tags = "建设项目—附件")
@RestController
@RequestMapping("/jsxm/psbaYqclBscl")
@Validated
public class PsbaYqclBsclController {

    @Resource
    private IPsbaYqclBsclService iPsbaYqclBsclService;

    /**
     * 添加建设项目—附件
     */
    @ApiOperation("添加建设项目—附件")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid PsbaYqclBscl psbaYqclBscl) {
        iPsbaYqclBsclService.save(psbaYqclBscl);
        return CommonResult.ok();
    }

    /**
     * 删除建设项目—附件
     */
    @ApiOperation("删除建设项目—附件")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iPsbaYqclBsclService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑建设项目—附件
     */
    @ApiOperation("编辑建设项目—附件")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid PsbaYqclBscl psbaYqclBscl) {
        iPsbaYqclBsclService.updateById(psbaYqclBscl);
        return CommonResult.ok();
    }

    /**
     * 建设项目—附件分页查询
     */
    @ApiOperation("建设项目—附件分页查询")
    @GetMapping("/list")
    public CommonResult<Page<PsbaYqclBscl>> page() {
        return CommonResult.data(iPsbaYqclBsclService.page(new PsbaYqclBscl()));
    }
}
